<template>
	<view class="cover">
		<image :src="cover" mode="widthFix"  @longpress="operator"></image>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cover:''
			}
		},
		onLoad(params){
		
	
			 this.cover = params.cover;;
			 
		},
		methods: {
		
			operator:function(){
					
			     uni.showActionSheet({
					itemList:['保存图片到本地'],
					success:(res) => {
					 
					   if(res.tapIndex ==0){
						  
						   uni.showLoading({
						   	title:"正在保存图片..."
						   });
						 
						   uni.downloadFile({
							   url:this.cover,
							   success:(result) => {
								   var tempFilePath = result.tempFilePath;
								   
								   uni.saveImageToPhotosAlbum({
								   	  filePath:tempFilePath,
									  success:() => {
										  uni.showToast({
										  	title:'保存成功',
											duration:2000
										  })
									  },
									
									   complete:()=>{
									   		  uni.hideLoading();
									   }
								
									 
								   })
							   }
						   })
					   }
					}
				
				})
			}
		}
	}
</script>

<style scoped>

  .cover{
	  display: flex;
	  flex-direction: column;
	 align-items: center;
	 justify-content: center;
	  position: fixed;
	  width: 100%;
	  height: 100%;
	  background-color: #000000;
	 
  }

 
</style>
